package galaxy.kernel.entity;

import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.Map;

import galaxy.kernel.component.ECSComponents;

public class ECSEnties {
    private Map<Class<? extends ECSEntity>, ECSEntity> entities = new LinkedHashMap<>();

    private Map<String, ECSEntity> entitiesById = new HashMap<>();

    public ECSComponents components = new ECSComponents();

    public boolean add(ECSEntity entity) {
        entity.setGlobalComponent(components);
        entity.setEnabled(true);
        this.entities.put(entity.getClass(), entity);
        entitiesById.put(entity.getId(), entity);
        return true;
    }

    public <T extends ECSEntity> T get(String entityId) {
        return (T)entitiesById.get(entityId);
    }
}
